Package | ch.fhir.ig.ch-rad-order |
Type | StructureMap |
Id | Id |
FHIR Version | R4 |
Source | http://fhir.ch/ig/ch-rad-order/https://build.fhir.org/ig/hl7ch/ch-rad-order/StructureMap-RadOrderQrToBundle.html |
Url | http://fhir.ch/ig/ch-rad-order/StructureMap/RadOrderQrToBundle |
Version | 2.0.0-ci-build |
Status | draft |
Date | 2024-11-05T14:07:30+00:00 |
Name | RadOrderQrToBundle |
Experimental | False |
Realm | ch |
Authority | hl7 |
Description | Radiologoy QuestionnaireResponse to Bundle Derived from ORF QuestionnaireResponse to Bundle 2021-01-11 Oliver Egger, copyright ahdis ag, Apache License QRF Questionnaire: http://fhir.ch/ig/ch-orf/Questionnaire-order-referral-form.html QRF QuestionnaireResponse: http://fhir.ch/ig/ch-orf/QuestionnaireResponse-order-referral-form.xml.html Bundle: http://fhir.ch/ig/ch-orf/StructureDefinition-ch-orf-document.html |
Copyright | CC0-1.0 |
No resources found
No resources found
Note: links and images are rebased to the (stated) source
Generated Narrative: StructureMap RadOrderQrToBundle
map "http://fhir.ch/ig/ch-rad-order/StructureMap/RadOrderQrToBundle" = "RadOrderQrToBundle" // Radiologoy QuestionnaireResponse to Bundle // Derived from ORF QuestionnaireResponse to Bundle // 2021-01-11 Oliver Egger, copyright ahdis ag, Apache License // QRF Questionnaire: http://fhir.ch/ig/ch-orf/Questionnaire-order-referral-form.html // QRF QuestionnaireResponse: http://fhir.ch/ig/ch-orf/QuestionnaireResponse-order-referral-form.xml.html // Bundle: http://fhir.ch/ig/ch-orf/StructureDefinition-ch-orf-document.html uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target uses "http://hl7.org/fhir/StructureDefinition/Composition" alias Composition as target uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target uses "http://hl7.org/fhir/StructureDefinition/RelatedPerson" alias RelatedPerson as target uses "http://hl7.org/fhir/StructureDefinition/Organization" alias Organization as target uses "http://hl7.org/fhir/StructureDefinition/Practitioner" alias Practitioner as target uses "http://hl7.org/fhir/StructureDefinition/PractitionerRole" alias PractitionerRole as target uses "http://hl7.org/fhir/StructureDefinition/ServiceRequest" alias ServiceRequest as target uses "http://hl7.org/fhir/StructureDefinition/Extension" alias Extension as target uses "http://hl7.org/fhir/StructureDefinition/EpisodeOfCare" alias EpisodeOfCare as target uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponseTarget as target uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target uses "http://hl7.org/fhir/StructureDefinition/Organization" alias Organization as target uses "http://hl7.org/fhir/StructureDefinition/Practitioner" alias Practitioner as target uses "http://hl7.org/fhir/StructureDefinition/PractitionerRole" alias PractitionerRole as target uses "http://hl7.org/fhir/StructureDefinition/ServiceRequest" alias ServiceRequest as target imports "http://fhir.ch/ig/ch-orf/StructureMap/OrfQrToBundle" group RadOrderQrToBundle(source qr : QuestionnaireResponse, target bundle : Bundle) { qr -> bundle.identifier as documentIdentifier, documentIdentifier.system = 'urn:ietf:rfc:3986', uuid() as uuidDoc, documentIdentifier.value = append('urn:uuid:', uuidDoc) "documentIdentifier"; qr as qrcp -> bundle.entry as e, e.resource = create('Composition') as composition, composition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), composition.title = 'Radiologieauftrag', composition.type as type, type.coding as coding, coding.code = '2161000195103', coding.system = 'urn:oid:2.16.756.5.30.1.127.3.4', coding.display = 'Imaging order (record artifact)', composition.category as category, category.coding as coding, coding.code = '721963009', coding.system = 'http://snomed.info/sct', coding.display = 'Order (record artifact)', bundle.entry as e2, bundle.timestamp = (now()) as timestamp, bundle.type = 'document', composition.date = timestamp, e2.resource = create('Patient') as patient, patient.id = uuid() as uuid2, e2.fullUrl = ('urn:uuid:' + %uuid2), bundle.entry as e4, e4.resource = create('QuestionnaireResponse') as questionnaireresp then { qr then QuestionnaireResponseMap(qr, questionnaireresp) "questionnaireresp"; qr -> questionnaireresp.id = uuid() as uuid4, e4.fullUrl = append('urn:uuid:', uuid4), bundle.entry as e5, e5.resource = create('ServiceRequest') as servicerequest, servicerequest.id = uuid() as uuid5, e5.fullUrl = ('urn:uuid:' + %uuid5) then { qr then OrfComposition(qr, composition, patient, questionnaireresp, servicerequest, bundle) "composition"; qr then QrToGroups(questionnaireresp, patient, bundle, composition, servicerequest) "orf"; qr then RadOrderQrToServiceRequest(questionnaireresp, patient, bundle, composition, servicerequest) "servicerequest"; } "servicerequest"; } "orfbundle"; } group RadOrderQrToServiceRequest(source qr : QuestionnaireResponse, target patient : Patient, target bundle : Bundle, target composition : Composition, target serviceRequest : ServiceRequest) { qr.item as grp where linkId = 'requestedService' then RequestedServiceItems(grp, serviceRequest) "requestedService"; qr.item as grp where linkId = 'reason' then ReasonServiceItems(grp, serviceRequest) "reason"; qr.item as grp where linkId = 'imagingService' then ImagingServiceItems(grp, serviceRequest) "imagingService"; qr.item as grp where linkId = 'orderDetail' then OrderDetailServiceItems(grp, serviceRequest) "orderDetail"; qr.item as grp where linkId = 'desiredRadiologist' then DesiredRadiologistServiceItems(grp, bundle, serviceRequest) "desiredRadiologist"; qr.item as grp where linkId = 'diagnosisList' then DiagnosisListServiceItems(grp, patient, bundle, serviceRequest) "diagnosisList"; qr.item as grp where linkId = 'caveat' then CaveatServiceItems(grp, patient, bundle, serviceRequest) "Caveat"; qr.item as grp where linkId = 'previousResults' then { grp.item as grp where linkId = 'attachedFile' then PreviousImagingStudyResultsNonDicom(grp, bundle, serviceRequest, patient) "attachment"; grp.item as grp where linkId = 'dicomObject' then PreviousImagingStudyResults(grp, bundle, serviceRequest, patient) "attachment"; } "previousResults"; } group RequestedServiceItems(source src, target serviceRequest : ServiceRequest) { src.item as item where ((linkId.value = 'requestedService.service') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.category as cc, cc.coding = coding "requestedServiceService"; } "answerCalueCoding"; } "itemAnswer"; } group ReasonServiceItems(source src, target serviceRequest : ServiceRequest) { src.item as item where ((linkId.value = 'reason.question') and answer.exists()) then { item.answer as answer then { answer.value : string as value -> serviceRequest.reasonCode as reasonCode, reasonCode.text = value "reasonQuestion"; } "answerValueString"; } "itemAnswer"; } group ImagingServiceItems(source src, target serviceRequest : ServiceRequest) { src.item as item where ((linkId.value = 'imagingService.type') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.code as code, code.coding = coding "requestedServiceService"; } "answerValueCoding"; } "itemAnswer"; } group OrderDetailServiceItems(source src, target serviceRequest : ServiceRequest) { src.item as item where ((linkId.value = 'orderDetail.imagingRegion') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.orderDetail as cc, cc.extension as ext, ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type', ext.value = create('Coding') as coding, coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type', coding.code = 'imagingRegion', cc.coding = coding "orderDetailImagingRegion"; } "answerValueCoding"; } "itemAnswer"; src.item as item where ((linkId.value = 'orderDetail.imagingFocus') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.bodySite as cc, cc.coding = coding "orderDetailImagingFocus"; } "answerValueCoding"; } "itemAnswer"; src.item as item where ((linkId.value = 'orderDetail.laterality') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.orderDetail as cc, cc.extension as ext, ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type', ext.value = create('Coding') as coding, coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type', coding.code = 'laterality', cc.coding = coding "orderDetailLaterality"; } "answerValueCoding"; } "itemAnswer"; src.item as item where ((linkId.value = 'orderDetail.viewType') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.orderDetail as cc, cc.extension as ext, ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type', ext.value = create('Coding') as coding, coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type', coding.code = 'viewType', cc.coding = coding "orderDetailViewType"; } "answerValueCoding"; } "itemAnswer"; src.item as item where ((linkId.value = 'orderDetail.maneuverType') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.orderDetail as cc, cc.extension as ext, ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type', ext.value = create('Coding') as coding, coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type', coding.code = 'maneuverType', cc.coding = coding "orderDetailManeuverType"; } "answerValueCoding"; } "itemAnswer"; src.item as item where ((linkId.value = 'orderDetail.guidanceForAction') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.orderDetail as cc, cc.extension as ext, ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type', ext.value = create('Coding') as coding, coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type', coding.code = 'guidanceForAction', cc.coding = coding "orderDetailGuidanceForAction"; } "answerValueCoding"; } "itemAnswer"; } group DesiredRadiologistServiceItems(source src, target bundle : Bundle, target serviceRequest : ServiceRequest) { src -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid, serviceRequest.performer as performer, performer.reference = ('urn:uuid:' + %uuid), e.fullUrl = ('urn:uuid:' + %uuid) then { src.item as item where ((linkId.value = 'desiredRadiologist.familyName') and answer.exists()) -> practitioner.name as name share name, name.family = (%item.answer.value); src.item as item where ((linkId.value = 'desiredRadiologist.givenName') and answer.exists()) -> practitioner.name as name share name, name.given = (%item.answer.value); } "serviceRequestPerformer"; } group DiagnosisListServiceItems(source src, target patient : Patient, target bundle : Bundle, target serviceRequest : ServiceRequest) { src.item as item where ((linkId.value = 'diagnosisList.primaryDiagnosis') and answer.exists()) then { item.answer as answer then { answer.value : string as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.reasonReference as reasonReference, reasonReference.reference = ('urn:uuid:' + %uuid), condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.text = value, condition.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) "diagnosisListPrimaryDiagnosis"; } "answerValueString"; } "itemAnswer"; src.item as item where ((linkId.value = 'diagnosisList.secondaryDiagnosis') and answer.exists()) then { item.answer as answer then { answer.value : string as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.text = value, condition.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) "diagnosisListSecondaryDiagnosis"; } "answerValueString"; } "itemAnswer"; src.item as item where ((linkId.value = 'diagnosisList.bodyHeight') and answer.exists()) then { item.answer as answer then { answer.value : Quantity as value -> bundle.entry as e, e.resource = create('Observation') as observation, observation.status = 'final', observation.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), observation.status = 'final', serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), observation.category as category, category.coding as coding, coding.code = 'vital-signs', coding.system = 'http://terminology.hl7.org/CodeSystem/observation-category', observation.value = value, observation.code as cc, cc.coding as c, c.system = 'http://loinc.org', c.code = '8302-2', observation.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) "observationBodyHeight"; } "answerValueString"; } "itemAnswer"; src.item as item where ((linkId.value = 'diagnosisList.bodyWeight') and answer.exists()) then { item.answer as answer then { answer.value : Quantity as value -> bundle.entry as e, e.resource = create('Observation') as observation, observation.status = 'final', observation.id = uuid() as uuid, observation.status = 'final', e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), observation.category as category, category.coding as coding, coding.code = 'vital-signs', coding.system = 'http://terminology.hl7.org/CodeSystem/observation-category', observation.value = value, observation.code as cc, cc.coding as c, c.system = 'http://loinc.org', c.code = '29463-7', observation.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) "observationBbodyWeight"; } "answerValueString"; } "itemAnswer"; } group CaveatServiceItems(source src, target patient : Patient, target bundle : Bundle, target serviceRequest : ServiceRequest) { src.item as item where ((linkId.value = 'caveatList.bloodCoagulation') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '64779008', coding.system = 'http://snomed.info/sct', coding.display = 'Blood coagulation disorder (disorder)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '64779008', coding2.system = 'http://snomed.info/sct', coding2.display = 'Blood coagulation disorder (disorder)', condition.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) then { answer.item as subitem where (linkId.value = 'caveatList.bloodCoagulation.INR') -> bundle.entry as e, e.resource = create('Observation') as observation, observation.id = uuid() as uuid, observation.status = 'final', e.fullUrl = ('urn:uuid:' + %uuid), condition.evidence as evidence, evidence.detail as detail, detail.reference = ('urn:uuid:' + %uuid), observation.code as cc, cc.coding as c, c.system = 'http://loinc.org', c.code = '34714-6', observation.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) then { subitem.item as quantityitem where ((linkId.value = 'caveatList.bloodCoagulation.INR.quantity') and answer.exists()) then { quantityitem.answer as answer then { answer.value : Quantity as value -> observation.value = value; } "caveatBloodCoagulationINRQuantityValue"; } "caveatBloodCoagulationINRQuantity"; subitem.item as datetimeitem where ((linkId.value = 'caveatList.bloodCoagulation.INR.dateTime') and answer.exists()) then { datetimeitem.answer as answer then { answer.value : dateTime as value -> observation.effective = value; } "caveatBloodCoagulationINRDateTimeValue"; } "caveatBloodCoagulationINRDateTime"; } "caveatBloodCoagulationINR"; answer.item as subitem where (linkId.value = 'caveatList.bloodCoagulation.platelets') -> bundle.entry as e, e.resource = create('Observation') as observation, observation.id = uuid() as uuid, observation.status = 'final', e.fullUrl = ('urn:uuid:' + %uuid), condition.evidence as evidence, evidence.detail as detail, detail.reference = ('urn:uuid:' + %uuid), observation.code as cc, cc.coding as c, c.system = 'http://loinc.org', c.code = '26515-7', observation.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) then { subitem.item as quantityitem where ((linkId.value = 'caveatList.bloodCoagulation.platelets.quantity') and answer.exists()) then { quantityitem.answer as answer then { answer.value : Quantity as value -> observation.value = value; } "caveatBloodCoagulationINRPlateletsValue"; } "caveatBloodCoagulationINRPlatelets"; subitem.item as datetimeitem where ((linkId.value = 'caveatList.bloodCoagulation.platelets.dateTime') and answer.exists()) then { datetimeitem.answer as answer then { answer.value : dateTime as value -> observation.effective = value; } "caveatBloodCoagulationINRPlateletsValue"; } "caveatBloodCoagulationINRPlatelets"; } "caveatBloodCoagulationINR"; } "bloodCoagulation"; } "answerValueString"; } "itemAnswer"; src.item as item where ((linkId.value = 'caveatList.renalInsufficiency') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '723188008', coding.system = 'http://snomed.info/sct', coding.display = 'Renal insufficiency (disorder)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '723188008', coding2.system = 'http://snomed.info/sct', coding2.display = 'Renal insufficiency (disorder)', condition.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) then { answer.item as subitem where (linkId.value = 'caveatList.renalInsufficiency.creatinineClearance') -> bundle.entry as e, e.resource = create('Observation') as observation, observation.status = 'final', observation.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), condition.evidence as evidence, evidence.detail as detail, detail.reference = ('urn:uuid:' + %uuid), observation.code as cc, cc.coding as c, c.system = 'http://loinc.org', c.code = '33558-8', observation.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) then { subitem.item as quantityitem where ((linkId.value = 'caveatList.renalInsufficiency.creatinineClearance.quantity') and answer.exists()) then { quantityitem.answer as answer then { answer.value : Quantity as value -> observation.value = value; } "caveatListRenalInsufficiencyCreatinineClearanceQuantityValue"; } "caveatListRenalInsufficiencyCreatinineClearanceQuantity"; subitem.item as datetimeitem where ((linkId.value = 'caveatList.renalInsufficiency.creatinineClearance.dateTime') and answer.exists()) then { datetimeitem.answer as answer then { answer.value : dateTime as value -> observation.effective = value; } "caveatListRenalInsufficiencyCreatinineClearanceDateTimeValue"; } "caveatListRenalInsufficiencyCreatinineClearancedateTime"; } "caveatListRenalInsufficiencyCreatinineClearanceINR"; answer.item as subitem where (linkId.value = 'caveatList.renalInsufficiency.creatinine') -> bundle.entry as e, e.resource = create('Observation') as observation, observation.status = 'final', observation.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), condition.evidence as evidence, evidence.detail as detail, detail.reference = ('urn:uuid:' + %uuid), observation.code as cc, cc.coding as c, c.system = 'http://loinc.org', c.code = '77140-2', observation.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) then { subitem.item as quantityitem where ((linkId.value = 'caveatList.renalInsufficiency.creatinine.quantity') and answer.exists()) then { quantityitem.answer as answer then { answer.value : Quantity as value -> observation.value = value; } "caveatListRenalInsufficiencyCreatinineValue"; } "caveatListRenalInsufficiencyCreatinine"; subitem.item as datetimeitem where ((linkId.value = 'caveatList.renalInsufficiency.creatinine.dateTime') and answer.exists()) then { datetimeitem.answer as answer then { answer.value : dateTime as value -> observation.effective = value; } "caveatListRenalInsufficiencyCreatininevalue"; } "caveatBloodCoagulationINRPlatelets"; } "caveatListRenalInsufficiencyCreatinine"; } "bloodCoagulation"; } "answerValueString"; } "itemAnswer"; src.item as item where ((linkId.value = 'caveatList.claustrophobia') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '19887002', coding.system = 'http://snomed.info/sct', coding.display = 'Claustrophobia (finding)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '19887002', coding2.system = 'http://snomed.info/sct', coding2.display = 'Claustrophobia (finding)', condition.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) "caveatListClaustrophobia"; } "answerValueString"; } "itemAnswer"; src.item as item where ((linkId.value = 'caveatList.bodyPiercing') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '879862001', coding.system = 'http://snomed.info/sct', coding.display = 'Body piercing (finding)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '879862001', coding2.system = 'http://snomed.info/sct', coding2.display = 'Body piercing (finding)', condition.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) "caveatListBodyPiercing"; } "answerValueString"; } "itemAnswer"; src.item as item where ((linkId.value = 'caveatList.device') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '397578001', coding.system = 'http://snomed.info/sct', coding.display = 'Device in situ (finding)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = create('Coding') as coding, coding.code = '52101004', coding.system = 'http://snomed.info/sct', coding.display = 'Present (qualifier value)', condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding = value, condition.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) "caveatListDevice"; } "answerValueString"; } "itemAnswer"; src.item as item where ((linkId.value = 'caveatList.hyperthyroidism') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '34486009', coding.system = 'http://snomed.info/sct', coding.display = 'Hyperthyroidism (disorder)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '34486009', coding2.system = 'http://snomed.info/sct', coding2.display = 'Hyperthyroidism (disorder)', condition.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) "caveatListHyperthyroidism"; } "answerValueString"; } "itemAnswer"; src.item as item where ((linkId.value = 'caveatList.diabetes') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '73211009', coding.system = 'http://snomed.info/sct', coding.display = 'Diabetes mellitus (disorder)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '73211009', coding2.system = 'http://snomed.info/sct', coding2.display = 'Diabetes mellitus (disorder)', condition.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) "caveatListDiabetes"; } "answerValueString"; } "itemAnswer"; src.item as item where ((linkId.value = 'caveatList.gravida') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '366321006', coding.system = 'http://snomed.info/sct', coding.display = 'Finding of gravida (finding)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '366321006', coding2.system = 'http://snomed.info/sct', coding2.display = 'Finding of gravida (finding)', condition.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) "caveatListGravida"; } "answerValueString"; } "itemAnswer"; src.item as item where ((linkId.value = 'caveatList.contrastMediaAllergy') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '293637006', coding.system = 'http://snomed.info/sct', coding.display = 'Allergy to contrast media (finding)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '293637006', coding2.system = 'http://snomed.info/sct', coding2.display = 'Allergy to contrast media (finding)', condition.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) "caveatListContrastMediaAllergy"; } "answerValueString"; } "itemAnswer"; // "caveatListDrugPrescription.metformin" // caveatList.drugPrescription.betaBlocke src.item as item where (linkId.value = 'caveatList.drugPrescription') then DesiredRadiologistServiceItemsDrugDescription(item, bundle, serviceRequest, patient) "DrugPrescription"; } group DesiredRadiologistServiceItemsDrugDescription(source src, target bundle : Bundle, target serviceRequest : ServiceRequest, target patient : Patient) { src.item as item where (linkId.value = 'caveatList.drugPrescription.metformin') then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '182817000', coding.system = 'http://snomed.info/sct', coding.display = 'Drug prescription (situation)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '372567009', coding2.system = 'http://snomed.info/sct', coding2.display = 'Metformin (substance)', condition.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) "caveatListDrugPrescription"; } "answerValueString"; } "caveatListDrugPrescriptionMetformin"; src.item as item where (linkId.value = 'caveatList.drugPrescription.betaBlocker') then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + %uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '182817000', coding.system = 'http://snomed.info/sct', coding.display = 'Drug prescription (situation)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '373254001', coding2.system = 'http://snomed.info/sct', coding2.display = 'Substance with beta adrenergic receptor antagonist mechanism of action (substance)', condition.subject as subject, subject.reference = ('urn:uuid:' + %patient.id) "caveatListDrugPrescription"; } "answerValueString"; } "caveatListDrugPrescriptionBetaBlocker"; } group PreviousImagingStudyResultsNonDicom(source item, target bundle : Bundle, target serviceRequest : ServiceRequest, target patient : Patient) { item as item -> bundle.entry as e, e.resource = create('DocumentReference') as documentReference, documentReference.id = uuid() as uuid, documentReference.subject as subject, subject.reference = ('urn:uuid:' + %patient.id), e.fullUrl = append('urn:uuid:', uuid), documentReference.status = 'current', serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + %uuid) then { item.answer as answer -> documentReference.content as content, content.attachment = (%answer.value) as attachment then { answer.item as dictomitem where ((linkId.value = 'attachedFile.description') and answer.exists()) -> documentReference.description = (%dictomitem.answer.value) "description"; } "answerValueString"; } "itemAnswer"; } group PreviousImagingStudyResults(source item, target bundle : Bundle, target serviceRequest : ServiceRequest, target patient : Patient) { item as item -> bundle.entry as e, e.resource = create('ImagingStudy') as imagingStudy, imagingStudy.id = uuid() as uuid, imagingStudy.status = 'available', imagingStudy.subject as subject, subject.reference = ('urn:uuid:' + %patient.id), e.fullUrl = append('urn:uuid:', uuid), serviceRequest.subject as subject, subject.reference = ('urn:uuid:' + %patient.id), serviceRequest.supportingInfo as supportingInfo, imagingStudy.series as series, series.instance as instance, supportingInfo.reference = ('urn:uuid:' + %uuid) then { item.answer as answer then { answer.value : string as value -> imagingStudy.description = value "description"; } "answerValueString"; item.item as item where (linkId.value = 'dicomObject.sopInstanceUid') and answer.exists() -> instance.uid = (%item.answer.value) "uid"; item.item as item where (linkId.value = 'dicomObject.modality') and answer.exists() -> series.modality as modality, modality.code = (%item.answer.value.code) "modality"; item.item as item where (linkId.value = 'dicomObject.studyInstanceUid') and answer.exists() -> imagingStudy.identifier as uid, uid.type as type, type.coding as coding, coding.system = 'urn:dicom:uid', coding.code = 'PLAC', uid.value = (%item.answer.value) "uid"; item.item as item where (linkId.value = 'dicomObject.SeriesInstanceUid') and answer.exists() -> series.uid = (%item.answer.value) "attachmentdicomSeriesInstanceUid"; item.item as item where (linkId.value = 'dicomObject.acsn') and answer.exists() -> imagingStudy.identifier as acsn, acsn.type as type, type.coding as coding, coding.system = 'http://terminology.hl7.org/CodeSystem/v2-0203', coding.code = 'ACSN', acsn.value = (%item.answer.value) "acsn"; } "supportingInfo"; }
{
"resourceType" : "StructureMap",
"id" : "RadOrderQrToBundle",
"text" : {
"status" : "generated",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap RadOrderQrToBundle</b></p><a name=\"RadOrderQrToBundle\"> </a><a name=\"hcRadOrderQrToBundle\"> </a><a name=\"RadOrderQrToBundle-en-US\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> "</span>http://fhir.ch/ig/ch-rad-order/StructureMap/RadOrderQrToBundle<span style=\"color: navy\">" = "</span>RadOrderQrToBundle<span style=\"color: navy\">"\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Radiologoy QuestionnaireResponse to Bundle</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Derived from ORF QuestionnaireResponse to Bundle</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">2021-01-11 Oliver Egger, copyright ahdis ag, Apache License</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">QRF Questionnaire: http://fhir.ch/ig/ch-orf/Questionnaire-order-referral-form.html</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">QRF QuestionnaireResponse: http://fhir.ch/ig/ch-orf/QuestionnaireResponse-order-referral-form.xml.html</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Bundle: http://fhir.ch/ig/ch-orf/StructureDefinition-ch-orf-document.html</span>\r\n\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/questionnaireresponse.html\" title=\"QuestionnaireResponse\">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style=\"color: navy\">" </span><b>alias </b>QuestionnaireResponse <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">" </span><b>alias </b>Bundle <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/composition.html\" title=\"Composition\">http://hl7.org/fhir/StructureDefinition/Composition</a><span style=\"color: navy\">" </span><b>alias </b>Composition <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/patient.html\" title=\"Patient\">http://hl7.org/fhir/StructureDefinition/Patient</a><span style=\"color: navy\">" </span><b>alias </b>Patient <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/relatedperson.html\" title=\"RelatedPerson\">http://hl7.org/fhir/StructureDefinition/RelatedPerson</a><span style=\"color: navy\">" </span><b>alias </b>RelatedPerson <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/organization.html\" title=\"Organization\">http://hl7.org/fhir/StructureDefinition/Organization</a><span style=\"color: navy\">" </span><b>alias </b>Organization <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/practitioner.html\" title=\"Practitioner\">http://hl7.org/fhir/StructureDefinition/Practitioner</a><span style=\"color: navy\">" </span><b>alias </b>Practitioner <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/practitionerrole.html\" title=\"PractitionerRole\">http://hl7.org/fhir/StructureDefinition/PractitionerRole</a><span style=\"color: navy\">" </span><b>alias </b>PractitionerRole <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/servicerequest.html\" title=\"ServiceRequest\">http://hl7.org/fhir/StructureDefinition/ServiceRequest</a><span style=\"color: navy\">" </span><b>alias </b>ServiceRequest <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/extensibility.html#Extension\" title=\"Extension\">http://hl7.org/fhir/StructureDefinition/Extension</a><span style=\"color: navy\">" </span><b>alias </b>Extension <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/episodeofcare.html\" title=\"EpisodeOfCare\">http://hl7.org/fhir/StructureDefinition/EpisodeOfCare</a><span style=\"color: navy\">" </span><b>alias </b>EpisodeOfCare <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/questionnaireresponse.html\" title=\"QuestionnaireResponse\">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style=\"color: navy\">" </span><b>alias </b>QuestionnaireResponseTarget <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/questionnaireresponse.html\" title=\"QuestionnaireResponse\">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style=\"color: navy\">" </span><b>alias </b>QuestionnaireResponse <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">" </span><b>alias </b>Bundle <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/patient.html\" title=\"Patient\">http://hl7.org/fhir/StructureDefinition/Patient</a><span style=\"color: navy\">" </span><b>alias </b>Patient <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/organization.html\" title=\"Organization\">http://hl7.org/fhir/StructureDefinition/Organization</a><span style=\"color: navy\">" </span><b>alias </b>Organization <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/practitioner.html\" title=\"Practitioner\">http://hl7.org/fhir/StructureDefinition/Practitioner</a><span style=\"color: navy\">" </span><b>alias </b>Practitioner <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/practitionerrole.html\" title=\"PractitionerRole\">http://hl7.org/fhir/StructureDefinition/PractitionerRole</a><span style=\"color: navy\">" </span><b>alias </b>PractitionerRole <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/servicerequest.html\" title=\"ServiceRequest\">http://hl7.org/fhir/StructureDefinition/ServiceRequest</a><span style=\"color: navy\">" </span><b>alias </b>ServiceRequest <b>as </b><b>target</b>\r\n\r\n<b>imports</b><span style=\"color: navy\"> "</span><a href=\"https://build.fhir.org/ig/hl7ch/ch-orf/StructureMap-OrfQrToBundle.html\" title=\"OrfQrToBundle\">http://fhir.ch/ig/ch-orf/StructureMap/OrfQrToBundle</a><span style=\"color: navy\">"\r\n</span>\r\n<b>group </b>RadOrderQrToBundle<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span> bundle.identifier<b> as </b><span style=\"color: maroon\">documentIdentifier</span><span style=\"color: navy\">, </span> documentIdentifier.system = <span style=\"color: blue\">'urn:ietf:rfc:3986'</span><span style=\"color: navy\">, </span> <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuidDoc</span><span style=\"color: navy\">, </span> documentIdentifier.value = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuidDoc</span><span style=\"color: navy\">)</span> <i>"documentIdentifier"</i><span style=\"color: navy\">;</span>\r\n qr<b> as </b><span style=\"color: maroon\">qrcp</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Composition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span> composition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.title = <span style=\"color: blue\">'Radiologieauftrag'</span><span style=\"color: navy\">, </span> composition.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'2161000195103'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.127.3.4'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Imaging order (record artifact)'</span><span style=\"color: navy\">, </span> composition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'721963009'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Order (record artifact)'</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> bundle.timestamp = <span style=\"color: navy\">(</span>now()<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">timestamp</span><span style=\"color: navy\">, </span> bundle.type = <span style=\"color: blue\">'document'</span><span style=\"color: navy\">, </span> composition.date = <span style=\"color: maroon\">timestamp</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span> patient.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> e2.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid2<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'QuestionnaireResponse'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">questionnaireresp</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr<b> then </b>QuestionnaireResponseMap<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">)</span> <i>"questionnaireresp"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span> questionnaireresp.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'ServiceRequest'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">, </span> servicerequest.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">, </span> e5.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid5<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr<b> then </b>OrfComposition<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>"composition"</i><span style=\"color: navy\">;</span>\r\n qr<b> then </b>QrToGroups<span style=\"color: navy\">(</span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">)</span> <i>"orf"</i><span style=\"color: navy\">;</span>\r\n qr<b> then </b>RadOrderQrToServiceRequest<span style=\"color: navy\">(</span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">)</span> <i>"servicerequest"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"servicerequest"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"orfbundle"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>RadOrderQrToServiceRequest<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'requestedService'<b> then </b>RequestedServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"requestedService"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'reason'<b> then </b>ReasonServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"reason"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'imagingService'<b> then </b>ImagingServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"imagingService"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'orderDetail'<b> then </b>OrderDetailServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"orderDetail"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'desiredRadiologist'<b> then </b>DesiredRadiologistServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"desiredRadiologist"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'diagnosisList'<b> then </b>DiagnosisListServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"diagnosisList"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'caveat'<b> then </b>CaveatServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"Caveat"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'previousResults'<b> then</b><span style=\"color: navy\"> {\r\n</span> grp.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'attachedFile'<b> then </b>PreviousImagingStudyResultsNonDicom<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">)</span> <i>"attachment"</i><span style=\"color: navy\">;</span>\r\n grp.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'dicomObject'<b> then </b>PreviousImagingStudyResults<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">)</span> <i>"attachment"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"previousResults"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>RequestedServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'requestedService.service') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -> </b></span> serviceRequest.category<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>"requestedServiceService"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerCalueCoding"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReasonServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'reason.question') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>string<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> serviceRequest.reasonCode<b> as </b><span style=\"color: maroon\">reasonCode</span><span style=\"color: navy\">, </span> reasonCode.text = <span style=\"color: maroon\">value</span> <i>"reasonQuestion"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ImagingServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'imagingService.type') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -> </b></span> serviceRequest.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding = <span style=\"color: maroon\">coding</span> <i>"requestedServiceService"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueCoding"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>OrderDetailServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'orderDetail.imagingRegion') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -> </b></span> serviceRequest.orderDetail<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'imagingRegion'</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>"orderDetailImagingRegion"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueCoding"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'orderDetail.imagingFocus') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -> </b></span> serviceRequest.bodySite<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>"orderDetailImagingFocus"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueCoding"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'orderDetail.laterality') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -> </b></span> serviceRequest.orderDetail<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'laterality'</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>"orderDetailLaterality"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueCoding"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'orderDetail.viewType') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -> </b></span> serviceRequest.orderDetail<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'viewType'</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>"orderDetailViewType"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueCoding"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'orderDetail.maneuverType') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -> </b></span> serviceRequest.orderDetail<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'maneuverType'</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>"orderDetailManeuverType"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueCoding"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'orderDetail.guidanceForAction') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -> </b></span> serviceRequest.orderDetail<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'guidanceForAction'</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>"orderDetailGuidanceForAction"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueCoding"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>DesiredRadiologistServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> serviceRequest.performer<b> as </b><span style=\"color: maroon\">performer</span><span style=\"color: navy\">, </span> performer.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'desiredRadiologist.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'desiredRadiologist.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"serviceRequestPerformer"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>DiagnosisListServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'diagnosisList.primaryDiagnosis') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>string<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.reasonReference<b> as </b><span style=\"color: maroon\">reasonReference</span><span style=\"color: navy\">, </span> reasonReference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.text = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"diagnosisListPrimaryDiagnosis"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'diagnosisList.secondaryDiagnosis') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>string<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.text = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"diagnosisListSecondaryDiagnosis"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'diagnosisList.bodyHeight') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Quantity<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">observation</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> observation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'vital-signs'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/observation-category'</span><span style=\"color: navy\">, </span> observation.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> observation.code<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding<b> as </b><span style=\"color: maroon\">c</span><span style=\"color: navy\">, </span> c.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> c.code = <span style=\"color: blue\">'8302-2'</span><span style=\"color: navy\">, </span> observation.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"observationBodyHeight"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'diagnosisList.bodyWeight') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Quantity<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">observation</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> observation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'vital-signs'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/observation-category'</span><span style=\"color: navy\">, </span> observation.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> observation.code<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding<b> as </b><span style=\"color: maroon\">c</span><span style=\"color: navy\">, </span> c.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> c.code = <span style=\"color: blue\">'29463-7'</span><span style=\"color: navy\">, </span> observation.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"observationBbodyWeight"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>CaveatServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.bloodCoagulation') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'64779008'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Blood coagulation disorder (disorder)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'64779008'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Blood coagulation disorder (disorder)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.item<b> as </b><span style=\"color: maroon\">subitem</span><b> where </b>(linkId.value = 'caveatList.bloodCoagulation.INR')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">observation</span><span style=\"color: navy\">, </span> observation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.evidence<b> as </b><span style=\"color: maroon\">evidence</span><span style=\"color: navy\">, </span> evidence.detail<b> as </b><span style=\"color: maroon\">detail</span><span style=\"color: navy\">, </span> detail.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.code<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding<b> as </b><span style=\"color: maroon\">c</span><span style=\"color: navy\">, </span> c.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> c.code = <span style=\"color: blue\">'34714-6'</span><span style=\"color: navy\">, </span> observation.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> subitem.item<b> as </b><span style=\"color: maroon\">quantityitem</span><b> where </b>((linkId.value = 'caveatList.bloodCoagulation.INR.quantity') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> quantityitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Quantity<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>observation.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatBloodCoagulationINRQuantityValue"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatBloodCoagulationINRQuantity"</i><span style=\"color: navy\">;</span>\r\n subitem.item<b> as </b><span style=\"color: maroon\">datetimeitem</span><b> where </b>((linkId.value = 'caveatList.bloodCoagulation.INR.dateTime') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> datetimeitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>dateTime<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>observation.effective = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatBloodCoagulationINRDateTimeValue"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatBloodCoagulationINRDateTime"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatBloodCoagulationINR"</i><span style=\"color: navy\">;</span>\r\n answer.item<b> as </b><span style=\"color: maroon\">subitem</span><b> where </b>(linkId.value = 'caveatList.bloodCoagulation.platelets')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">observation</span><span style=\"color: navy\">, </span> observation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.evidence<b> as </b><span style=\"color: maroon\">evidence</span><span style=\"color: navy\">, </span> evidence.detail<b> as </b><span style=\"color: maroon\">detail</span><span style=\"color: navy\">, </span> detail.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.code<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding<b> as </b><span style=\"color: maroon\">c</span><span style=\"color: navy\">, </span> c.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> c.code = <span style=\"color: blue\">'26515-7'</span><span style=\"color: navy\">, </span> observation.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> subitem.item<b> as </b><span style=\"color: maroon\">quantityitem</span><b> where </b>((linkId.value = 'caveatList.bloodCoagulation.platelets.quantity') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> quantityitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Quantity<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>observation.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatBloodCoagulationINRPlateletsValue"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatBloodCoagulationINRPlatelets"</i><span style=\"color: navy\">;</span>\r\n subitem.item<b> as </b><span style=\"color: maroon\">datetimeitem</span><b> where </b>((linkId.value = 'caveatList.bloodCoagulation.platelets.dateTime') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> datetimeitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>dateTime<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>observation.effective = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatBloodCoagulationINRPlateletsValue"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatBloodCoagulationINRPlatelets"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatBloodCoagulationINR"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"bloodCoagulation"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.renalInsufficiency') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'723188008'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Renal insufficiency (disorder)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'723188008'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Renal insufficiency (disorder)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.item<b> as </b><span style=\"color: maroon\">subitem</span><b> where </b>(linkId.value = 'caveatList.renalInsufficiency.creatinineClearance')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">observation</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> observation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.evidence<b> as </b><span style=\"color: maroon\">evidence</span><span style=\"color: navy\">, </span> evidence.detail<b> as </b><span style=\"color: maroon\">detail</span><span style=\"color: navy\">, </span> detail.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.code<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding<b> as </b><span style=\"color: maroon\">c</span><span style=\"color: navy\">, </span> c.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> c.code = <span style=\"color: blue\">'33558-8'</span><span style=\"color: navy\">, </span> observation.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> subitem.item<b> as </b><span style=\"color: maroon\">quantityitem</span><b> where </b>((linkId.value = 'caveatList.renalInsufficiency.creatinineClearance.quantity') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> quantityitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Quantity<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>observation.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatListRenalInsufficiencyCreatinineClearanceQuantityValue"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatListRenalInsufficiencyCreatinineClearanceQuantity"</i><span style=\"color: navy\">;</span>\r\n subitem.item<b> as </b><span style=\"color: maroon\">datetimeitem</span><b> where </b>((linkId.value = 'caveatList.renalInsufficiency.creatinineClearance.dateTime') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> datetimeitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>dateTime<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>observation.effective = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatListRenalInsufficiencyCreatinineClearanceDateTimeValue"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatListRenalInsufficiencyCreatinineClearancedateTime"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatListRenalInsufficiencyCreatinineClearanceINR"</i><span style=\"color: navy\">;</span>\r\n answer.item<b> as </b><span style=\"color: maroon\">subitem</span><b> where </b>(linkId.value = 'caveatList.renalInsufficiency.creatinine')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">observation</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> observation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.evidence<b> as </b><span style=\"color: maroon\">evidence</span><span style=\"color: navy\">, </span> evidence.detail<b> as </b><span style=\"color: maroon\">detail</span><span style=\"color: navy\">, </span> detail.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.code<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding<b> as </b><span style=\"color: maroon\">c</span><span style=\"color: navy\">, </span> c.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> c.code = <span style=\"color: blue\">'77140-2'</span><span style=\"color: navy\">, </span> observation.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> subitem.item<b> as </b><span style=\"color: maroon\">quantityitem</span><b> where </b>((linkId.value = 'caveatList.renalInsufficiency.creatinine.quantity') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> quantityitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Quantity<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>observation.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatListRenalInsufficiencyCreatinineValue"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatListRenalInsufficiencyCreatinine"</i><span style=\"color: navy\">;</span>\r\n subitem.item<b> as </b><span style=\"color: maroon\">datetimeitem</span><b> where </b>((linkId.value = 'caveatList.renalInsufficiency.creatinine.dateTime') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> datetimeitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>dateTime<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>observation.effective = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatListRenalInsufficiencyCreatininevalue"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatBloodCoagulationINRPlatelets"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatListRenalInsufficiencyCreatinine"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"bloodCoagulation"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.claustrophobia') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'19887002'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Claustrophobia (finding)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'19887002'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Claustrophobia (finding)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"caveatListClaustrophobia"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.bodyPiercing') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'879862001'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Body piercing (finding)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'879862001'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Body piercing (finding)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"caveatListBodyPiercing"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.device') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'397578001'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Device in situ (finding)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'52101004'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Present (qualifier value)'</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"caveatListDevice"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.hyperthyroidism') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'34486009'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Hyperthyroidism (disorder)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'34486009'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Hyperthyroidism (disorder)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"caveatListHyperthyroidism"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.diabetes') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'73211009'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Diabetes mellitus (disorder)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'73211009'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Diabetes mellitus (disorder)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"caveatListDiabetes"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.gravida') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'366321006'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Finding of gravida (finding)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'366321006'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Finding of gravida (finding)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"caveatListGravida"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.contrastMediaAllergy') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'293637006'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Allergy to contrast media (finding)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'293637006'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Allergy to contrast media (finding)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"caveatListContrastMediaAllergy"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">"caveatListDrugPrescription.metformin"</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">caveatList.drugPrescription.betaBlocke</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'caveatList.drugPrescription')<b> then </b>DesiredRadiologistServiceItemsDrugDescription<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">)</span> <i>"DrugPrescription"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>DesiredRadiologistServiceItemsDrugDescription<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'caveatList.drugPrescription.metformin')<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'182817000'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Drug prescription (situation)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'372567009'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Metformin (substance)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"caveatListDrugPrescription"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatListDrugPrescriptionMetformin"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'caveatList.drugPrescription.betaBlocker')<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'182817000'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Drug prescription (situation)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'373254001'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Substance with beta adrenergic receptor antagonist mechanism of action (substance)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"caveatListDrugPrescription"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"caveatListDrugPrescriptionBetaBlocker"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>PreviousImagingStudyResultsNonDicom<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">item</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> item<b> as </b><span style=\"color: maroon\">item</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'DocumentReference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">documentReference</span><span style=\"color: navy\">, </span> documentReference.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> documentReference.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> documentReference.status = <span style=\"color: blue\">'current'</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span> documentReference.content<b> as </b><span style=\"color: maroon\">content</span><span style=\"color: navy\">, </span> content.attachment = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">attachment</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.item<b> as </b><span style=\"color: maroon\">dictomitem</span><b> where </b>((linkId.value = 'attachedFile.description') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>documentReference.description = <span style=\"color: navy\">(</span>%dictomitem.answer.value<span style=\"color: navy\">)</span> <i>"description"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>PreviousImagingStudyResults<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">item</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> item<b> as </b><span style=\"color: maroon\">item</span><span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'ImagingStudy'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">imagingStudy</span><span style=\"color: navy\">, </span> imagingStudy.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> imagingStudy.status = <span style=\"color: blue\">'available'</span><span style=\"color: navy\">, </span> imagingStudy.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> imagingStudy.series<b> as </b><span style=\"color: maroon\">series</span><span style=\"color: navy\">, </span> series.instance<b> as </b><span style=\"color: maroon\">instance</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>string<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>imagingStudy.description = <span style=\"color: maroon\">value</span> <i>"description"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"answerValueString"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'dicomObject.sopInstanceUid') and answer.exists()<span style=\"color: navy\"><b> -> </b></span>instance.uid = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"uid"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'dicomObject.modality') and answer.exists()<span style=\"color: navy\"><b> -> </b></span> series.modality<b> as </b><span style=\"color: maroon\">modality</span><span style=\"color: navy\">, </span> modality.code = <span style=\"color: navy\">(</span>%item.answer.value.code<span style=\"color: navy\">)</span> <i>"modality"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'dicomObject.studyInstanceUid') and answer.exists()<span style=\"color: navy\"><b> -> </b></span> imagingStudy.identifier<b> as </b><span style=\"color: maroon\">uid</span><span style=\"color: navy\">, </span> uid.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'urn:dicom:uid'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'PLAC'</span><span style=\"color: navy\">, </span> uid.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"uid"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'dicomObject.SeriesInstanceUid') and answer.exists()<span style=\"color: navy\"><b> -> </b></span>series.uid = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"attachmentdicomSeriesInstanceUid"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'dicomObject.acsn') and answer.exists()<span style=\"color: navy\"><b> -> </b></span> imagingStudy.identifier<b> as </b><span style=\"color: maroon\">acsn</span><span style=\"color: navy\">, </span> acsn.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/v2-0203'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'ACSN'</span><span style=\"color: navy\">, </span> acsn.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"acsn"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"supportingInfo"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
},
"url" : "http://fhir.ch/ig/ch-rad-order/StructureMap/RadOrderQrToBundle",
"version" : "2.0.0-ci-build",
"name" : "RadOrderQrToBundle",
"status" : "draft",
"date" : "2024-11-05T14:07:30+00:00",
"publisher" : "HL7 Switzerland",
"contact" : [
{
"name" : "Juerg P. Bleuer",
"telecom" : [
{
"system" : "url",
"value" : "https://www.hl7.ch"
}
]
}
],
"description" : "Radiologoy QuestionnaireResponse to Bundle\r\nDerived from ORF QuestionnaireResponse to Bundle\r\n2021-01-11 Oliver Egger, copyright ahdis ag, Apache License\r\nQRF Questionnaire: http://fhir.ch/ig/ch-orf/Questionnaire-order-referral-form.html\r\nQRF QuestionnaireResponse: http://fhir.ch/ig/ch-orf/QuestionnaireResponse-order-referral-form.xml.html\r\nBundle: http://fhir.ch/ig/ch-orf/StructureDefinition-ch-orf-document.html",
"jurisdiction" : [
{
"coding" : [
{
"system" : "urn:iso:std:iso:3166",
"code" : "CH"
}
]
}
],
"copyright" : "CC0-1.0",
"structure" : [
{
"url" : "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
"mode" : "source",
"alias" : "QuestionnaireResponse"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
"mode" : "target",
"alias" : "Bundle"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Composition",
"mode" : "target",
"alias" : "Composition"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Patient",
"mode" : "target",
"alias" : "Patient"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/RelatedPerson",
"mode" : "target",
"alias" : "RelatedPerson"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Organization",
"mode" : "target",
"alias" : "Organization"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Practitioner",
"mode" : "target",
"alias" : "Practitioner"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/PractitionerRole",
"mode" : "target",
"alias" : "PractitionerRole"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/ServiceRequest",
"mode" : "target",
"alias" : "ServiceRequest"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Extension",
"mode" : "target",
"alias" : "Extension"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/EpisodeOfCare",
"mode" : "target",
"alias" : "EpisodeOfCare"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
"mode" : "target",
"alias" : "QuestionnaireResponseTarget"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
"mode" : "source",
"alias" : "QuestionnaireResponse"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
"mode" : "target",
"alias" : "Bundle"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Patient",
"mode" : "target",
"alias" : "Patient"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Organization",
"mode" : "target",
"alias" : "Organization"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Practitioner",
"mode" : "target",
"alias" : "Practitioner"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/PractitionerRole",
"mode" : "target",
"alias" : "PractitionerRole"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/ServiceRequest",
"mode" : "target",
"alias" : "ServiceRequest"
}
],
"import" : [
"http://fhir.ch/ig/ch-orf/StructureMap/OrfQrToBundle"
],
"group" : [
{
"name" : "RadOrderQrToBundle",
"typeMode" : "none",
"input" : [
{
"name" : "qr",
"type" : "QuestionnaireResponse",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
}
],
"rule" : [
{
"name" : "documentIdentifier",
"source" : [
{
"context" : "qr"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "identifier",
"variable" : "documentIdentifier"
},
{
"context" : "documentIdentifier",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:ietf:rfc:3986"
}
]
},
{
"contextType" : "variable",
"variable" : "uuidDoc",
"transform" : "uuid"
},
{
"context" : "documentIdentifier",
"contextType" : "variable",
"element" : "value",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuidDoc"
}
]
}
]
},
{
"name" : "orfbundle",
"source" : [
{
"context" : "qr",
"variable" : "qrcp"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "resource",
"variable" : "composition",
"transform" : "create",
"parameter" : [
{
"valueString" : "Composition"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid",
"transform" : "uuid"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "title",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Radiologieauftrag"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "type",
"variable" : "type"
},
{
"context" : "type",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2161000195103"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.16.756.5.30.1.127.3.4"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "display",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Imaging order (record artifact)"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "category",
"variable" : "category"
},
{
"context" : "category",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "721963009"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://snomed.info/sct"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "display",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Order (record artifact)"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e2"
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "timestamp",
"variable" : "timestamp",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "now()"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "type",
"transform" : "copy",
"parameter" : [
{
"valueString" : "document"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "date",
"transform" : "copy",
"parameter" : [
{
"valueId" : "timestamp"
}
]
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "resource",
"variable" : "patient",
"transform" : "create",
"parameter" : [
{
"valueString" : "Patient"
}
]
},
{
"context" : "patient",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid2",
"transform" : "uuid"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid2"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "questionnaireresp",
"transform" : "create",
"parameter" : [
{
"valueString" : "QuestionnaireResponse"
}
]
}
],
"rule" : [
{
"name" : "questionnaireresp",
"source" : [
{
"context" : "qr"
}
],
"dependent" : [
{
"name" : "QuestionnaireResponseMap",
"variable" : [
"qr",
"questionnaireresp"
]
}
]
},
{
"name" : "servicerequest",
"source" : [
{
"context" : "qr"
}
],
"target" : [
{
"context" : "questionnaireresp",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid4"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e5"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "resource",
"variable" : "servicerequest",
"transform" : "create",
"parameter" : [
{
"valueString" : "ServiceRequest"
}
]
},
{
"context" : "servicerequest",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid5",
"transform" : "uuid"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid5"
}
]
}
],
"rule" : [
{
"name" : "composition",
"source" : [
{
"context" : "qr"
}
],
"dependent" : [
{
"name" : "OrfComposition",
"variable" : [
"qr",
"composition",
"patient",
"questionnaireresp",
"servicerequest",
"bundle"
]
}
]
},
{
"name" : "orf",
"source" : [
{
"context" : "qr"
}
],
"dependent" : [
{
"name" : "QrToGroups",
"variable" : [
"questionnaireresp",
"patient",
"bundle",
"composition",
"servicerequest"
]
}
]
},
{
"name" : "servicerequest",
"source" : [
{
"context" : "qr"
}
],
"dependent" : [
{
"name" : "RadOrderQrToServiceRequest",
"variable" : [
"questionnaireresp",
"patient",
"bundle",
"composition",
"servicerequest"
]
}
]
}
]
}
]
}
]
},
{
"name" : "RadOrderQrToServiceRequest",
"typeMode" : "none",
"input" : [
{
"name" : "qr",
"type" : "QuestionnaireResponse",
"mode" : "source"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "composition",
"type" : "Composition",
"mode" : "target"
},
{
"name" : "serviceRequest",
"type" : "ServiceRequest",
"mode" : "target"
}
],
"rule" : [
{
"name" : "requestedService",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'requestedService'"
}
],
"dependent" : [
{
"name" : "RequestedServiceItems",
"variable" : [
"grp",
"serviceRequest"
]
}
]
},
{
"name" : "reason",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'reason'"
}
],
"dependent" : [
{
"name" : "ReasonServiceItems",
"variable" : [
"grp",
"serviceRequest"
]
}
]
},
{
"name" : "imagingService",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable"